<?php
import( 'tools.Setup.interfaces.SetupScreen' );
class BaseSetupScreen
{
	public function __construct( $config, $words, $screenID, $path )
	{
		$this->config	= $config;
		$this->screenID	= $screenID;
		$this->path		= $path;
		$this->name		= $this->getNameFromScreenID( $screenID );

		$this->config	= $config['screens'][$screenID];
		$this->words	= $words[$this->getLanguage()][$this->name];
	}
	
	protected function loadTemplate( $data = array(), $name = false )
	{
		extract( $data );
		$__name	= $name ? $name : $this->name;
		return	require_once( $this->path."templates/".$__name.".phpt" );
	}

	public function getNameFromScreenID( $id )
	{
		foreach( $this->config['screens'] as $screenID => $screenData )
		{
			if( $screenID == $id )
				return $screenData['name'];
		}
	}
	
	public function getLanguage()
	{
		if( isset( $_SESSION['bts_language'] ) )
			return $_SESSION['bts_language'];
		return NULL;
	}
	
	public function setLanguage( $language )
	{
		$_SESSION['bts_language'] = $language;
	}
}
?>